﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hfm.Core.DataAccess.Contract;
using Hfm.Common.Entity.Contract;
using System.Web.UI.WebControls;

namespace Hfm.Core.BusinessManager.Contract
{
    public class ContractManager
    {
        protected readonly ContractData ContractDataAccess;
        protected ContractManager()
        {

        }
        public ContractManager(ContractData context)
        {
            this.ContractDataAccess = context;
        }
        public void Create(ContractEntity contract)
        {
            ContractDataAccess.Create(contract);
        }
        public virtual ContractEntity GetContractById(int id)
        {
            return ContractDataAccess.GetContractById(id);
        }

        public virtual int GetContactsCount(string Customer = null, string ContractName = null, string ContractNumber = null)
        {
            return ContractDataAccess.GetContactsCount(Customer: Customer, ContractName: ContractName, ContractNumber: ContractNumber);
        }

        public virtual IList<NewContractEntity> GetContacts(string Customer = null, string ContractName = null, string ContractNumber = null, int? skip = null, int? take = null)
        {
            return ContractDataAccess.GetContacts(Customer: Customer, ContractName: ContractName, ContractNumber: ContractNumber, skip: skip, take: take);
        }

        public virtual void CreateContract(ContractEntity Contract)
        {
            ContractDataAccess.CreateContract(Contract);
        }
        public virtual void UpdateContract(ContractEntity Contract)
        {
            ContractDataAccess.UpdateContract(Contract);
        }
        public virtual void DeleteContract(int id)
        {
            ContractDataAccess.DeleteContract(id);
        }
        public bool IsExitesContractNumber(string number)
        {
            return ContractDataAccess.IsExitesContractNumber(number);
        }
    }
}
